<template>
  <div class="bgc">
    <!-- 全部 -->
    <!-- 商品描述 -->
    <div class="describe">
      <div
        v-for="(item, index) in AllorderData"
        :key="index"
        class="order-content"
      >
        <div class="describe-header">
          <div class="des-hea-title">商品描述商品描述</div>
          <img src="../../assets/images/jiantou.png" alt="" height="16px" />
        </div>
        <div class="content">
          <img src="../../assets/images/yhImg_03.gif" alt="" />
          <div class="cont-right">
            <h4>{{ item.title }}</h4>
            <div class="cont-center">
              <span class="span1">下单时间</span>
              <span>{{ item.orderTime }}</span>
            </div>
            <div class="bottom">
              <span class="span1">下单人</span>
              <span>{{ item.orderUserName }}</span>
            </div>
          </div>
        </div>
        <div class="btn">
          <button
            @click="gosendSku(item)"
            v-if="item.status == 0"
            class="fhbtn"
          >
            发货
          </button>
          <button
            @click="shouhuo(item)"
            v-else-if="item.status == 10"
            class="shbtn"
          >
            收货
          </button>
          <button
            @click="pjclick(item)"
            v-else-if="item.status == 20"
            class="pjbtn"
          >
            评价
          </button>
          <button
            @click="ckClick(item)"
            v-else-if="item.status == 30"
            class="ckpj"
          >
            查看评价
          </button>
        </div>
      </div>
    </div>

    <van-overlay v-show="show">
      <div class="wrapper" @click.stop>
        <div class="block">
          <h1>是否确认收货？</h1>
          <div>
            <span @click="show = false">取消</span>
            <span @click="querenClick">确认收货</span>
          </div>
        </div>
      </div>
    </van-overlay>
  </div>
</template>

<script>
import { querenGoods } from "../../request/api";
export default {
  props: ["AllorderData","showpltbn"],
  data() {
    return {
      show: false,
      //   存信息
      item: [],
      //   订单号
      serialNo: [],
    };
  },
  created(){
   
  },
  methods: {
    pjclick(item) {
      this.$router.push({
        name: "Estimate",
        query: {
          item: item,
          showpltbn: true,
        },
      });
    },
    gosendSku(item) {
      // console.log(item);
      this.$router.push({
        name: "UserImformation",
        query: {
          item: item,
        },
      });
    },

    //   收货
    shouhuo(item) {
      this.show = true;
      //   console.log(item);
      this.item = item;
    },
    // 确认收货
    querenClick() {
      this.show = false;
      this.serialNo = this.item.serialNo;
      querenGoods({
        serialNo: this.serialNo,
      }).then((res) => {
        if (res.data.errCode == 0) {
          //   console.log(res);
          // 刷新页面
          location.reload();
        }
      });
    },

    // 查看评价
    ckClick(item) {
      this.$router.push({
        name: "Estimate",
        query: {
          item: item,
          showpltbn: false,
        },
      });


    },
  },
};
</script>
 
<style lang = "less" scoped>
.bgc {
  margin-top: 10px;
}
.describe {
  width: 100%;
  box-sizing: border-box;
  .describe-header {
    padding: 0 15px;
    height: 60px;
    line-height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e5e5;
  }
}

.btn {
  border-top: 1px solid #e5e5e5;
  overflow: hidden;
  background-color: #fff;
  button {
    float: right;
    margin: 10px;
    border: 0;
    width: 80px;
    height: 40px;
    border-radius: 20px;
  }
  .fhbtn {
    color: #fff;
    background-color: #294d95;
  }
  .shbtn {
    border: 1px solid #4a68e1;
    color: #4a68e1;
    background-color: #fff;
  }
  .pjbtn {
    color: #fff;
    background-color: #ffcc33;
  }
  .ckpj {
    border: 1px solid #ffcc33;
    color: #ffcc33;
    background-color: #fff;
  }
}

.order-content {
  padding: 0 15px;
  box-sizing: border-box;
  width: 100%;
  margin-bottom: 10px;
  background-color: #fff;
}
.content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  padding: 20px 0;
  img {
    width: 25%;
  }

  .cont-right {
    .cont-center {
      margin: 10px 0;
    }
    .span1 {
      color: #b0b0b0;
      margin-right: 20px;
    }

    h4{
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }
}
.wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.block {
  width: 70%;
  /* height: 120px; */
  background-color: #fff;
  border-radius: 5px;

  h1 {
    padding: 25px;
    text-align: center;
    border-bottom: 1px solid #e5e5e5;
  }
  div {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    height: 40px;
    span {
      width: 50%;
      user-select: none;
      &:nth-of-type(1) {
        border-right: 1px solid #e5e5e5;
      }
      &:nth-of-type(2) {
        color: skyblue;
      }
    }
  }
}
</style>